// 定义品牌接口模块地方
import request from "@/utils/request";
import type { TradeMarkResponseData, TradeMark } from "./type";
// 定义枚举类型
enum API {
  // 获取的数据
  GETTRADEMARK_URL = "/admin/product/baseTrademark/",
  // 添加
  ADDTRAINDMARK_URL = "/admin/product/baseTrademark/save",
  // 更新图片
  UPDATETRAINDMARK_URL = "/admin/product/baseTrademark/update",
  // 删除一个商品
  REMOVETRAINDMARK_URL = "/admin/product/baseTrademark/remove/",
}
// 获取品牌数据
export const reqTradeMarkList = (page: number, limit: number) =>
  request.get<any, TradeMarkResponseData>(
    API.GETTRADEMARK_URL + `${page}/${limit}`
  );
// 添加新的和更新
export const reqAddorUpdateTradeMark = (data: TradeMark) => {
  if (data.id) {
    return request.put<any, any>(API.UPDATETRAINDMARK_URL, data);
  } else {
    return request.post<any, any>(API.ADDTRAINDMARK_URL, data);
  }
};
// 删除一个商品的
export const reqRemoveTradeMark = (id: number) =>
  request.delete<any, any>(API.REMOVETRAINDMARK_URL + id);
